<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%
  content_for :page_title, @tag.title
  add_crumb @tag.context_module.name, context_url(@context, :context_context_modules_url)
  add_crumb @tag.title
  js_bundle :file_inline
  js_bundle 'module_sequence_footer'
%>
  <h1 class="screenreader-only"><%= @tag.title %></h1>
  <% if @tag.try(:new_tab) %>
    <%= t :new_tab, "This site needs to be opened in a new browser window." %>
    <div>
      <a id="open_url_button" target="_blank" class="btn external"
         href="<%= @tag.url %>"
         title="<%= t("Open %{title} in a new window", :title => @tag.title) %>"
         aria-label="<%= t("Open %{title} in a new window", :title => @tag.title) %>">
        <%= t("Open %{title} in a new window", :title => @tag.title) %>
      </a>
    </div>
  <% else %>
    <% if @tag.url.start_with?('http://') %>
      <div class="alert alert-error" id="insecure_content_msg">
        <p>
          <%= t('You are trying to launch insecure content from within a secure site (canvas).
            Some web browsers may prevent this content from loading.') %>
        </p>
      </div>
    <% end %>
    <ul style="margin-top:0" class="ui-listview ui-listview-no-rounded-bottom">
      <li class="active">
        <span style="font-size:18px; text-align: center; padding: .2em" class="ui-listview-text">
          <a href="<%= @tag.url %>"><%= @tag.title %></a>
        </span>
      </li>
      <li>
        <span style="padding:0" class="ui-listview-text">
          <%= iframe(@tag.url, :id => 'file_content', :style => "width:100%; height: 400px; float:left;") %>
          <!-- had to float then clear this because there was a space below the iframe I couldnt figure out how to get to go away -->
          <div class="clear"></div>
        </span>
      </li>
    </ul>
  <% end %>

{{> views/shared/sequence_footer}}
